/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package flower;

import java.awt.Image;
import java.awt.Point;
import java.awt.Toolkit;
import java.io.File;
import java.net.URL;

/**
 *
 * @author Administrator
 */
public class Flower{
    Image normal,gray;
    int index;
    private static final Toolkit kit = Toolkit.getDefaultToolkit();
    
    private Flower() {}
    
    static Flower newFlower(int ind) {
        try {
            Flower f = new Flower();
            URL normal = Flower.class.getResource("flower" +ind + ".jpg");
            URL gray = Flower.class.getResource("flower" + ind + "gray.jpg");
            //if(!new File(normal.toURI()).exists() || !new File(gray.toURI()).exists()) throw new Exception();
            f.normal = kit.getImage(normal);
            f.gray = kit.getImage(gray);
            f.index = ind;
            return f;
        } catch (Exception ex) {
            System.err.println(ind + " doens't exist");
            return null;
        }
    }
    
    public String toString() { return index + ""; }
    
}
